import TextureRenderUtils from "../TextureRenderUtils";


const { ccclass, property } = cc._decorator;

@ccclass
export default class CaptureComp extends cc.Component {

    @property(cc.Camera)
    camera: cc.Camera = null;

    //最后需要这个node生成图片需要的数据
    @property(cc.Node)
    renderNode: cc.Node = null;

    protected textureHelper: TextureRenderUtils = new TextureRenderUtils();

    start() {
        this.textureHelper.init(this.camera, this.renderNode)
    }

    getPixelFormat(){
        return this.textureHelper.getPixelFormat()
    }

    get width(){
        return this.textureHelper.width
    }

    get height(){
        return this.textureHelper.height;
    }



    getDataurl() {
        return this.textureHelper.getDataUrl()
    }

    getData(){
        return this.textureHelper.getData();
    }

    render(){
        this.textureHelper.render();
    }
}